let myQuestionsApp = new Vue({
    el: '#myQuestionsApp',
    data: {
        questions: [
            {
                statusText:'未解决',
                statusClass: 'badge-warning',
                title: '问题1的标题',
                content: '问题1的正文',
                tags: [
                    {id: 1,name: 'JAVA基础'},
                    {id: 2,name:'JavaOOP'}
                    ],
                userNickName:'张三',
                hits: 916,
                gmtCreateText: '3小时前'
            },
            {
                statusText:'已回复',
                statusClass: 'badge-info',
                title: '问题2的标题',
                content: '问题2的正文',
                tags: [{id: 5,name: 'mybatis'},{id: 6,name:'MybatisPlus'}],
                userNickName:'张三',
                hits: 123,
                gmtCreateText: '13小时前'
            }
        ],
        prePage: 0,
        nextPage: 0,
        navigatepageNums: [],
        currentPageNum: 0
    },
    methods:{
        loadMyQuestions: function(page){
            // alert('准备加载"我的回答"列表...');
            $.ajax({
                url: '/api-question/v1/question/my',
                data: 'page=' + page,
                success: function(r){
                    let list = r.data.list;
                    alert('.......');
                    let statusText = ['未回复','已回复','已解决'];
                    let statusClass = ['badge-warning','badge-info','badge-success'];
                    for(let i = 0;i < list.length ; i++){
                        list[i].statusText = statusText[list[i].status];
                        list[i].statusClass = statusClass[list[i].status];
                        list[i].gmtCreateText =getTimeText(list[i].gmtCreate);
                    }
                    myQuestionsApp.questions = list;
                    myQuestionsApp.prePage = r.data.prePage;
                    myQuestionsApp.nextPage= r.data.nextPage;
                    myQuestionsApp.navigatepageNums=r.data.navigatepageNums;
                    myQuestionsApp.currentPageNum = r.data.pageNum;
                }
            });

        }
    },
    created: function(){
        this.loadMyQuestions(1);
    }
});